package com.zjcode.cdcer.service.impl;

import com.chinatechstar.component.commons.service.BaseService;
import com.zjcode.cdcer.mapper.TkmSysteminitImportInfoMapper;
import com.zjcode.cdcer.model.CerNjzdDetail;
import com.zjcode.cdcer.model.TkmSysteminitImportInfo;
import com.zjcode.cdcer.service.TkmSysteminitImportInfoService;
import java.util.List;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @ClassName:TkmSysteminitImportInfoServiceImpl
 * @功能：
 * @author：wlei
 * @日期：2022/7/23-02:36
 **/
@Service
@Slf4j
public class TkmSysteminitImportInfoServiceImpl implements TkmSysteminitImportInfoService,
                                                           BaseService {

    @Autowired
    private TkmSysteminitImportInfoMapper systeminitImportInfoMapper;

    @Override
    public int deleteById(String id) {
        String tradeId = get32UUID();
        log.info("初始数据临时库,删除数据,tradeId:{},id:{}", tradeId, id);
        //return systeminitImportInfoMapper.updateDeletedById(1, id);
        return systeminitImportInfoMapper.deleteById(id);
    }

    @Override
    public TkmSysteminitImportInfo findById(String id) {
        return systeminitImportInfoMapper.selectByPrimaryKey(id);
    }

    @Override
    public int updateRecord(TkmSysteminitImportInfo record) {
        return systeminitImportInfoMapper.updateByPrimaryKey(record);
    }

    @Override
    public int insertRecords(List<TkmSysteminitImportInfo> list) {
        return systeminitImportInfoMapper.insertList(list);
    }

    @Override
    public int insertRecord(TkmSysteminitImportInfo info) {
        return systeminitImportInfoMapper.insert(info);
    }

    @Override
    public List<TkmSysteminitImportInfo> findAllByDateTimeRange(String start, String end) {
        return systeminitImportInfoMapper.selectAllByInsertDatetimeBetweenOrEqualTo(start, end);
    }

    @Override
    public int findInitCountByPersonId(String personId) {
        return systeminitImportInfoMapper.findInitCountByPersonId(personId);
    }

    @Override
    public void delNjzdDetail(String systeminitImportInfoId) {
        systeminitImportInfoMapper.delNjzdDetail(systeminitImportInfoId);
    }

    @Override
    public void addNjzdDetail(CerNjzdDetail njzdDetail) {
        systeminitImportInfoMapper.addNjzdDetail(njzdDetail);
    }

    @Override
    public CerNjzdDetail selNjzdDetailBySysteminitImportInfoId(String systeminitImportInfoId) {
        return systeminitImportInfoMapper.selNjzdDetailBySysteminitImportInfoId(systeminitImportInfoId);
    }
}
